package com.da.javatest.niuke.baodian;

import com.da.javatest.niuke.common.ListNode;

/**
 * @author chenlida
 * @date 2020/10/6 12:14
 * https://www.nowcoder.com/practice/baefd05def524a92bcfa6e1f113ed4f0?tpId=8&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C13Palindrome {
    public boolean isPalindrome(ListNode pHead) {
        if (pHead == null) {
            return false;
        }
        StringBuilder sb = new StringBuilder();
        do {
            sb.append(pHead.val);
            pHead = pHead.next;
        } while (pHead != null);

        return sb.toString().equals(sb.reverse().toString());
    }
}
